package com.ytwl.service;

import com.ytwl.mapper.TruckTeamMapper;
import com.ytwl.bean.TruckTeam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TruckTeamService {
    @Autowired
    TruckTeamMapper truckTeamMapper;
    public Integer addTruckTeam(TruckTeam truckTeam) {
        return truckTeamMapper.insertSelective(truckTeam);
    }

    public List<TruckTeam> getAllTruckTeamByPage(Integer page, Integer size, String keyword) {
        if (page != null && size != null) {
            page = (page - 1) * size;
        }
        return truckTeamMapper.getAllTruckTeamByPage(page,size,keyword);
    }

    public Long getTotal(String keyword) {
        return truckTeamMapper.getTotal(keyword);
    }

    public Integer deleteTruckTeamById(Integer id) {
        return truckTeamMapper.deleteByPrimaryKey(id);
    }

    public Integer updateTruckTeamById(TruckTeam truckTeam) {
        return truckTeamMapper.updateByPrimaryKeySelective(truckTeam);
    }
}
